package com.zhanglu.fun.services.authentication.client;

import com.zhanglu.fun.services.authentication.bean.ApplicationRole;
import com.zhanglu.fun.services.authentication.bean.AuthToken;
import com.zhanglu.fun.services.authentication.bean.User;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description
 * @Auther zhanglu
 * @Date 2017/9/20 下午2:21
 */
@FeignClient("DATACENTER")
public interface DataCenterClient {
    @GetMapping("/auth/token")
    AuthToken getAuthTokenByToken(@RequestParam("token") String token);

    @PutMapping("/auth/token")
    Boolean addAuthTokenByToken(@RequestBody AuthToken authToken);

    @PostMapping("/auth/token")
    Boolean updateAuthTokenById(@RequestBody AuthToken authToken);

    @DeleteMapping("/auth/token")
    Boolean deleteAuthTokenByToken(@RequestParam("token") String token);

    @GetMapping("/user/private")
    User getUserByAccount(@RequestParam("username") String username, @RequestParam("password") String password);

    @GetMapping("/auth/token/{userId}")
    AuthToken getAuthTokenByUserId(@PathVariable("userId") Long userId);

    @GetMapping("/application/roles/{userId}")
    List<ApplicationRole> getApplicationRolesByUserId(@PathVariable("userId") Long userId);
}
